<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../src/function/bind.js"></script>
  <script src="../../src/function/call.js"></script>

</head>
<body>
  
</body>
<script>
  // 声明一个函数
  function add(a, b) {
    console.log(this);
    return a + b + this.c;
  }
  // 声明一个对象
  let obj = {
    c: 500
  }
  // 添加全局属性
  window.c = 1000;

  // 执行 bind 函数
  let fn = bind(add, obj, 10, 20);
  console.log(fn());  // 530

  let fn2 = bind(add, obj);
  console.log(fn2(10, 20)); // 530
</script>
</html>